home *** CD-ROM | disk | FTP | other *** search
- /* f s e e k
- *
- * Set the position of a stream. The new position is at the signed
- * distance offset bytes from either the beginning, current position
- * of end of the file. Any effects of ungetc() are undone.
- *
- * The function returns EOF for improper seeks, otherwise zero.
- *
- * Patchlevel 1.0
- *
- * Edit History:
- */
-
- #include "stdiolib.h"
-
- /*LINTLIBRARY*/
-
- int fseek(fp, offset, ptr)
-
- FILE *fp; /* stream */
- long offset; /* offset */
- int ptr; /* reference */
-
- {
- long lseek(); /* seek on file */
-
- if (fflush(fp) || lseek(fp->_file, offset, ptr) == EOF)
- return EOF;
-
- CLEARFLAG(fp, _IOEOF);
-
- if (TESTFLAG(fp, _IORW)) {
- CLEARFLAG(fp, (_IOREAD | _IOWRITE));
- FLUSHNEXTACCESS(fp);
- }
-
- return 0;
- }
-